UART DMA improvements and refactoring #328
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some preparation to allow variable sized DMA transfers as specified in #325 . I did not have to change anything in the
serial_dma
example, but this is unfortunately still a breaking change because of the DMA transfer wrappers which are now returned for DMA transactions. I re-tested theserial_dma
example on a STM32F3-Disco. In the process of reading a it about DMA, I also saw that the datasheet recommends checking the UART TC flag for transmission completeness. I am not sure whether this was not done on purpose or simply overlooked, but the changes ensure the TC flag is now checked as well.Copied from CHANGELOG:
Changed
write_all
andread_exact
now returnsthe wrapper structs
SerialDmaTx
andSerialDmaRx
instead of the directDMA transfer struct. These allow checking the USART ISR events
with
is_event_triggered
as well.Fixed
write_all
implementation did use the DMA transfer completionevent to check for transfer completion, but MCU datasheet specifies that the TC
flag of the USART peripheral should be checked for transfer completion to avoid
corruption of the last transfer. This is now done by the new
SerialDmaTx
wrapper.Added
is_event_triggered
method which allows to check for eventsgiven an event and a USART reference.
If you consider this mergeable (with adaptions/changes), I also have some other branches which build on top of these changes, for example the splitting of RX and TX events. :)